package com.example.modulepicselector.engine.impl;

import android.content.Context;
import android.graphics.drawable.Drawable;


import android.net.Uri;
import android.widget.ImageView;

import com.example.modulepicselector.engine.ImageEngine;
import com.example.tanloadpic.TanLoadPic;
import com.example.tanloadpic.TanPicCompressConfig;


public class ImageTanEngine implements ImageEngine {


    @Override
    public void loadThumbnail(Context context, int resize, Drawable placeholder, ImageView imageView, Uri uri) {
/*        image.load(uri)
                .placeholder(placeholder)
                .setContext(context)
                .resize(resize, resize)
                .into(imageView);*/

        TanLoadPic.get(context).load(uri).setCompressConfig(new TanPicCompressConfig(128)).into(imageView);


    }

    @Override
    public void loadGifThumbnail(Context context, int resize, Drawable placeholder, ImageView imageView, Uri uri) {
        loadThumbnail(context, resize, placeholder, imageView, uri);
    }

    @Override
    public void loadImage(Context context, int compressConfigNum, ImageView imageView, Uri uri) {
//        image.load(uri).setContext(context).resize(resizeX, resizeY).into(imageView);
        TanLoadPic.get(context).load(uri).setCompressConfig(new TanPicCompressConfig(1024*512)).into(imageView);
    }

    @Override
    public void loadGifImage(Context context, int compressNum, ImageView imageView, Uri uri) {
        loadImage(context, compressNum, imageView, uri);
    }

    @Override
    public boolean supportAnimatedGif() {
        return false;
    }
}
